﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MengLin.OOP.DesignPattern.Decorator.CarDecorations.Models
{
    public class Decorator : AbstractCar
    {
        protected AbstractCar _car;
        protected int _decoratorCost;
        protected int _decoratorSalePrice;
        protected string _decoratorDescription;

        /// <summary>
        /// 设置装饰哪个汽车
        /// </summary>
        /// <param name="car"></param>
        public void SetCar(AbstractCar car)
        {
            _car = car;
        }

        /// <summary>
        /// 得到成本
        /// </summary>
        /// <returns></returns>
        public override int? GetCost()
        {
            return _decoratorCost + _car?.GetCost();
        }

        /// <summary>
        /// 得到销售价
        /// </summary>
        /// <returns></returns>
        public override int? GetSalePrice()
        {
            return _decoratorSalePrice + _car?.GetSalePrice();
        }

        /// <summary>
        /// 得到描述信息
        /// </summary>
        /// <returns></returns>
        public override string GetDescription()
        {
            return _decoratorDescription + _car?.GetDescription();
        }
    }
}
